package com.chandra.pos.employee.dao.entity;


import com.chandra.pos.common.entity.UserEntity;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/* @(#) EmployeeEntity.java
 * Copyright 2013 - 2015 QatarAirways Group. All Rights Reserved.
 *
 * This Software is the proprietary information of QR Group
 * Use is subject to License terms.
 * Created by T4671 on 18/03/2015.
 */
@Entity
@Table(name = "POS_EMPLOYEE")
public class EmployeeEntity extends UserEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "EMPLOYEE_ID")
    private Long employeeId;


    @Column(name = "USER_NAME")
    private String userName;


    @Column(name = "PASSWORD")
    private String password;


    @Column(name = "MONTHLY_SALARY")
    private Double monthlySalary;


    @Column(name = "ACCOUNT_EXPIRED")
    private boolean isAccountExpired = false;

    @Column(name = "ACCOUNT_LOCKED")
    private boolean isAccountLocked = false;

    @Column(name = "PASSWORD_EXPIRED")
    boolean isCredentialsExpired = false;

    @Column(name = "ENABLED")
    private boolean isEnabled = true;

    @Column(name = "JOIN_DATE", unique = false, nullable = true)
    @NotNull
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    protected DateTime joinDate;

    @Column(name = "LAST_LOGIN", unique = false, nullable = true)
    @NotNull
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    protected DateTime lastLogin;


//    @OneToMany(fetch = FetchType.LAZY, mappedBy = "employee")
//    @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
//            org.hibernate.annotations.CascadeType.MERGE,
//            org.hibernate.annotations.CascadeType.DELETE})
//    private Set<UserRoles> userRoles = new HashSet<UserRoles>(0);


    public DateTime getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(DateTime lastLogin) {
        this.lastLogin = lastLogin;
    }

    public boolean isAccountExpired() {
        return isAccountExpired;
    }

    public void setAccountExpired(boolean isAccountExpired) {
        this.isAccountExpired = isAccountExpired;
    }

    public boolean isAccountLocked() {
        return isAccountLocked;
    }

    public void setAccountLocked(boolean isAccountLocked) {
        this.isAccountLocked = isAccountLocked;
    }

    public boolean isCredentialsExpired() {
        return isCredentialsExpired;
    }

    public void setCredentialsExpired(boolean isCredentialsExpired) {
        this.isCredentialsExpired = isCredentialsExpired;
    }

    public boolean isEnabled() {
        return isEnabled;
    }

    public void setEnabled(boolean isEnabled) {
        this.isEnabled = isEnabled;
    }


    public Long getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(Long EmployeeId) {
        this.employeeId = EmployeeId;
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public Double getMonthlySalary() {
        return monthlySalary;
    }

    public void setMonthlySalary(Double monthlySalary) {
        this.monthlySalary = monthlySalary;
    }

    public DateTime getJoinDate() {
        return joinDate;
    }

    public void setJoinDate(DateTime joinDate) {
        this.joinDate = joinDate;
    }
}
